<!DOCTYPE html>
<html>
  
  <head>
    <meta charset="UTF-8">
    <title>后台管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="../../css/font.css">
    <link rel="stylesheet" href="../../css/xadmin.css">
    <script type="text/javascript" src="../../js/jquery-3.2.1.js"></script>
    <script type="text/javascript" src="../../lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../js/xadmin.js"></script>
  </head>
  
  <body>
    <div class="x-body">
			<table id="Table" lay-filter="test"></table>
    </div>
  
    <script type="text/html" id="barDemo">
			<a class="layui-btn layui-btn-xs" lay-event="reclaim">归还</a>
			<a class="layui-btn layui-btn-xs" lay-event="del">删除</a>
		</script>
    <script>
   console.log("未完成")
        layui.use(['table', 'layer'], function() {
					var layer = layui.layer;
					var table = layui.table;
					
					var data = {enable:1};
	        if(window.location.href.indexOf("?")!=-1){
	        	 var para =  window.location.href.substr(window.location.href.indexOf("?")+1);
	        	 if(para != null && para != undefined && para.trim() != ''){
	        		 para = para.replace(/=/g,"':'");
                     para = para.replace(/&/g,"','");
                     data = $.extend({},data,eval("({'"+para+"'})"));
	                 console.log(data);
	                 console.log(para);
	             }
	        }
					
					table.render({
					    elem: '#Table'
					    ,id: 'keyRecordTable'
					    ,height: 605
					    ,width:1200
					    ,url: '../retrievalKeyRecord' //数据接口
					    ,where:data
					    ,page: {limits:[10, 20, 30]} //开启分页
					    ,toolbar: true //开启工具栏
					    ,request: {
					   		pageName: 'pageNo' //页码的参数名称，默认：page
					    	,limitName: 'pageSize' //每页数据量的参数名，默认：limit
					  	}
					    ,cols: [[ //表头
					      {field: 'recordId', title: 'ID', width:100,  fixed: 'left'}
					      ,{field: 'keyId', title: '钥匙ID', width:150,  fixed: 'left'}
					      ,{title: '类型', width:100, templet:function(d){}}
					      ,{title: '名称', width:150, templet:function(d){}}
					      ,{field: 'lendCause', title: '理由', width:120 }
					      ,{field: 'lendTime', title: '借出时间', width:120, sort: true}
					      ,{field: 'restoreTime', title: '归还时间', width:120, sort: true}
					      ,{fixed: 'right', title: '操作', width: 160,templet:'#barDemo'}
					    ]]
				   });
					
					 //监听行工具事件
				table.on('tool(test)', function(obj){
	                    var data = obj.data;
	                    if(obj.event === 'reclaim'){
	                    } else if(obj.event === 'del'){
	                    }
	              
	            });
	   
      });
    </script>

  </body>

</html>